Skip to content

refactor: centralize server port resolution#4198

Open
KristjanESPERANTO wants to merge 1 commit into
MagicMirrorOrg:developfrom
KristjanESPERANTO:port
Open

refactor: centralize server port resolution#4198
KristjanESPERANTO wants to merge 1 commit into
MagicMirrorOrg:developfrom
KristjanESPERANTO:port

Conversation

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

I took a look at the last remaining FIXME comment in the code - the one in js/app.js pointing to PR #673. It's from 2017 and was already flagged as a hotfix back then.

The problem: MM_PORT got written into a global global.mmPort that was then read inconsistently across the code - sometimes via the global, sometimes straight from process.env, plus separate logic in defaults.js. Three ways to get the same port.

I pulled this into a single getServerPort() helper (MM_PORT -> config.port -> 8080) and switched app.js, defaults.js, server.js, electron.js and both serveronly files over to it. The global is gone now.

Basically the behavior should be unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant